/*
 * Copyright (c) 2008-2013 Haulmont. All rights reserved.
 * Use is subject to license terms, see http://www.cuba-platform.com/license for details.
 */

package com.haulmont.asu.web.ui.corporation_presenter;

import com.haulmont.asu.entity.CorporationPresenter;
import com.haulmont.cuba.gui.components.AbstractEditor;
import com.haulmont.cuba.gui.components.TextField;

import javax.inject.Inject;

/**
 * Author: Sergey42
 * Date: 10.11.13 1:35
 */
public class CorporationPresenterEditor extends AbstractEditor<CorporationPresenter> {

    @Inject
    protected TextField corporationTF;

    @Override
    protected void postInit() {
        CorporationPresenter presenter = getItem();
        if (presenter.getCorporation() != null) {
            corporationTF.setEditable(true);
            corporationTF.setValue(presenter.getCorporation().getName());
            corporationTF.setEditable(false);
        }
    }
}
